package com.example.leetdemo.process;

public class Solution1864 {

    public int minSwaps(String s) {
        int a = 0, b = 1;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '0') {
                a++;
            } else {
                b++;
            }
        }
        if (Math.abs(a - b) > 1) {
            return -1;
        }
        return 0;
    }

}
